package com.example.pulsar.controller;

import com.example.pulsar.bean.InitParamBean;
import com.example.pulsar.service.InitPulsarConfigure;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.pulsar.common.policies.data.Policies;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Auther: 141040
 * @Date: 3/26/2019 10:05
 * @Description:
 */
@Api(tags = "初始化租户和namespace", description = "初始化租户和namespace")
@RestController
public class InitPulsarController {

    @Autowired
    private InitPulsarConfigure initPulsarConfigure;

    @ApiOperation(value = "初始化租户和namespace请求方法", notes = "初始化租户和namespace请求方法")
    @PostMapping(value = "/init")
    public String init(@RequestBody InitParamBean initParamBean) {
        String init = initPulsarConfigure.init(initParamBean);
        return ObjectUtils.isEmpty(init) ? "获取到的数据为空,创建失败" : init;
    }

}
